package com.sqx.modules.pay.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.pay.entity.PayClassify;
import com.sqx.modules.pay.service.PayClassifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@Api(value = "支付分类", tags = {"购买金豆类型"})
@RequestMapping(value = "/classify")
public class PayClassifyController {
    @Autowired
    private PayClassifyService payClassifyService;


    @ApiOperation(value = "查询支付分类列表")
    @GetMapping("/selectPayClassifyList")
    public Result selectPayClassifyList(){
        return payClassifyService.selectPayClassifyList();
    }

    @ApiOperation(value = "查询支付分类详情")
    @GetMapping("/selectPayClassifyById")
    public Result selectPayClassifyById(@ApiParam("id")Integer payClassifyId){
        return payClassifyService.selectPayClassifyById(payClassifyId);
    }

    @ApiOperation(value = "修改支付分类")
    @PostMapping("/updatePayClassify")
    public Result updatePayClassify(@RequestBody PayClassify payClassify){
        payClassifyService.updatePayClassify(payClassify);
        return Result.success();
    }

    @ApiOperation(value = "删除支付分类")
    @PostMapping("/deletePayClassify")
    public Result deletePayClassify(Integer[] payClassifyIds){
        payClassifyService.deletePayClassify(payClassifyIds);
        return Result.success();
    }

    @ApiOperation(value = "新增支付分类")
    @PostMapping("/addPayClassify")
    public Result addPayClassify(@RequestBody PayClassify payClassify){
        payClassifyService.addPayClassify(payClassify);
        return Result.success();
    }

}
